package ServiceImpl;

import java.util.List;

import org.junit.Test;

import Dao.UserDao;
import DaoImpl.FinanceDaoImpl;
import DaoImpl.UserDaoImpl;
import Entity.Activity;
import Entity.Finance;
import Entity.Stclass;
import Entity.Stlist;
import Entity.User;
import Service.ActivityService;
import Service.FinanceService;
import Service.StclassService;
import Service.StlistService;
import Service.UserService;

public class TestUserDaoImpl {
	
	/*@Test
	@Test
	public void testJoin()
	{
		UserDaoImpl dao=new UserDaoImpl();
		if(dao.joinSt("1534120218", "1534120219"))
		{
			System.out.println("�ɹ�");
		}else{
			System.out.println("ʧ��");
		}
		
	}*/
	@Test
	public void login() {
		User u = new User();
		UserDao udao = new UserDaoImpl();
		u.setStudentId("00001");
//		u.setStupassword("123456");
		User ut = udao.login(u);
		System.out.println(ut);
	}
	//社团类别测试
	@Test
	public void testStClass()
	{
		StclassService stclass=new StclassService();
		Stclass stc=new Stclass("keji");
		stclass.addStclass(stc);
		//stc=stclass.findStclass(2);
		//stclass.deletcStclass(1);
		//stclass.updateStclass(2, stc);
		// stclass.delStFromStclass("456", 2);
		
	}
	//社团测试
	@Test
	public void testClub()
	{
		StlistService stservice=new StlistService();
		Stlist st=new Stlist("110", "sk", "tom", "2018-1-1", "123", "666");
		stservice.addSt(st);
		//Stlist st=stservice.findSt("123");
		//System.out.println(st.getStName());
		//stservice.SttoStclass("456", 2);
		//stservice.deleteSt("123");
		//Stlist st=new Stlist("wyqwe", "jerry", "2018-1-1", "123", "666");
		//stservice.updateSt("456", st);
		
	}
	//学生测试
		@Test
		public void testUser()
		{
			UserService userservice=new UserService();
//			User user=new User("114", "123456", "tom", "man", "1234567890", 1, "1299618103");
//			userservice.addUser(user);
			User user=userservice.findInformation("114");
			System.out.println(user.getStudentName()+","+user.getStudentId());
			//User user=new User("99999", "110", "123456");
			//userservice.updateInformation("111", user);
			//userservice.joinSt("113", "456");
			///userservice.outSt("111", "456");
		}
	//活动测试
	@Test
	public void testActivity()
	{
		ActivityService activityservice=new ActivityService();
		Activity activity=new Activity("458", "hot", "i love you", "2018-1-1");
		
		activityservice.addActivity(activity, "110");
		//Activity activity=new Activity();
		//activity=activityservice.findActivity("123");
		//System.out.println(activity.getActivityconcent());
		
		//Activity activity=new Activity("hot", "i don't love you", "2018-1-1");
		//activityservice.updateActivity(activity, "456");
//		activityservice.deleteActivity("456", "456");
	}
	
	//财务记录测试
	@Test
	public void testFinance()
	{
		FinanceService fiance=new FinanceService();
		Finance fia=new Finance("tom4", "jerry", "2018-1-1");
		fiance.addFinance(fia, "110");
//		List<Finance> list=fiance.selectFinance("110");
//		for(Finance f:list)
//		{
//			System.out.println(f.getGo());
//		}
		//Finance list=fiance.selectFinancebyId(2);
		//System.out.println(list.getGo());
	}
}
